import { onMounted } from 'vue'
import gsap from 'gsap'

export function useAnimation() {
  // GSAP 动画辅助函数
  const fadeIn = (target, options = {}) => {
    return gsap.from(target, {
      opacity: 0,
      y: 30,
      duration: 0.6,
      ease: 'power2.out',
      ...options
    })
  }
  
  const fadeInUp = (target, options = {}) => {
    return gsap.from(target, {
      opacity: 0,
      y: 50,
      duration: 0.8,
      ease: 'power3.out',
      ...options
    })
  }
  
  const scaleIn = (target, options = {}) => {
    return gsap.from(target, {
      opacity: 0,
      scale: 0.8,
      duration: 0.6,
      ease: 'back.out(1.7)',
      ...options
    })
  }
  
  const staggerFadeIn = (targets, options = {}) => {
    return gsap.from(targets, {
      opacity: 0,
      y: 30,
      duration: 0.6,
      stagger: 0.1,
      ease: 'power2.out',
      ...options
    })
  }
  
  return {
    fadeIn,
    fadeInUp,
    scaleIn,
    staggerFadeIn,
    gsap
  }
}

